Dimensions, units, and measurements are commonly used computational constructs in science and engineering. Accordingly, computer programs used in the science and engineering fields perform calculations using variables which are implicitly associated with dimensions and units. Traditionally, physical quantities (e.g., length=5 meters) were represented as numbers that correspond to the quantities' measurement in a particular unit (e.g., a length represented as a number of meters). Further, the unit and dimension of the measurement are typically only represented in the computer program in the names of variables used to hold these numbers.
As programming languages have evolved, the support for associating a unit and a dimension with a particular measurement has improved. For example, certain object-oriented languages have included support for encoding dimensions as ad hoc language features. An alternative to the ad hoc encoding of dimensions is to use a fixed set of dimensions. On such implementation of using the fixed set of dimensions is the SIUnits Library implemented in C++ via the Standard Template Library (See, for example, W. Brown. “Applied Template Metaprogramming in SIUnits: the Library of Unit-Based Computation.” In Proceedings of the Second Workshop on C++ Template Programming, October 2001.).
The aforementioned SIUnits Library supports checking of quantities expressed in the SI (Système International d'unités) system by encoding a quantity as one of seven dimensions addressed by the SI system as integer parameters of a template class Quantity. Under this approach, the parametric dimensions, class relationships between units, dimensions, quantities (i.e., measurements) are pre-defined.
There have also been a few attempts to integrate support for associating a unit and a dimension with a particular measurement into more general type systems. These approaches have focused on modifying structural type systems which have significantly different design considerations than those of mainstream object-oriented languages (See, for example, A. Kennedy, “Dimension Types,” In Proceedings of the 5th European Symposium on Programming Languages and Systems. Edinburgh, U.K., 1994.)